bitkeeper revision 1.1159.97.2 (415c13cd5VJC1zwMGjzqOrsURvQiOQ)
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Thu, 30 Sep 2004 14:10:21 +0000 (14:10 +0000)
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Thu, 30 Sep 2004 14:10:21 +0000 (14:10 +0000)
Move the shadow LDT test later in the pagefault handler.
It's a bug fix, but I doubt anyone ever hit it.

xen/arch/x86/traps.c

index ab5236cdfb01e17bccf8bd26fb4bc8e90dc4fd29..60d7c50bf23e26cdfbf207f39d90d1a733443622 100644 (file)
@@ -344,18 +344,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, long error_code)
 
     ASSERT_no_criticalregion();
 
-    if ( unlikely(addr >= LDT_VIRT_START) && 
-         (addr < (LDT_VIRT_START + (d->mm.ldt_ents*LDT_ENTRY_SIZE))) )
-    {
-        /*
-         * Copy a mapping from the guest's LDT, if it is valid. Otherwise we
-         * send the fault up to the guest OS to be handled.
-         */
-        off  = addr - LDT_VIRT_START;
-        addr = d->mm.ldt_base + off;
-        if ( likely(map_ldt_shadow_page(off >> PAGE_SHIFT)) )
-            return; /* successfully copied the mapping */
-    }
 
     if ( likely(VM_ASSIST(d, VMASST_TYPE_writable_pagetables)) )
     {
@@ -377,6 +365,19 @@ asmlinkage void do_page_fault(struct pt_regs *regs, long error_code)
          (addr < PAGE_OFFSET) && shadow_fault(addr, error_code) )
         return; /* Returns TRUE if fault was handled. */
 
+    if ( unlikely(addr >= LDT_VIRT_START) && 
+         (addr < (LDT_VIRT_START + (d->mm.ldt_ents*LDT_ENTRY_SIZE))) )
+    {
+        /*
+         * Copy a mapping from the guest's LDT, if it is valid. Otherwise we
+         * send the fault up to the guest OS to be handled.
+         */
+        off  = addr - LDT_VIRT_START;
+        addr = d->mm.ldt_base + off;
+        if ( likely(map_ldt_shadow_page(off >> PAGE_SHIFT)) )
+            return; /* successfully copied the mapping */
+    }
+
     if ( unlikely(!(regs->xcs & 3)) )
         goto xen_fault;